import type { ToolbarNames } from 'md-editor-v3'

export const allLeftToolbars: Array<ToolbarNames> = [
  'save',
  '-',
  'revoke',
  'next',
  '-',
  'bold',
  'underline',
  'italic',
  'strikeThrough',
  '-',
  'title',
  'sub',
  'sup',
  'quote',
  'unorderedList',
  'orderedList',
  'task',
  '-',
  'codeRow',
  'code',
  'table',
  'mermaid',
  'katex',
  'link',
  'image',
]

export const allRightToolbars: Array<ToolbarNames> = [
  'prettier',
  'pageFullscreen',
  'fullscreen',
  'preview',
  'htmlPreview',
  'catalog',
]

export const allToolbars: Array<ToolbarNames> = [
  'save',
  '-',
  'revoke',
  'next',
  '-',
  'bold',
  'underline',
  'italic',
  'strikeThrough',
  '-',
  'title',
  'sub',
  'sup',
  'quote',
  'unorderedList',
  'orderedList',
  'task',
  '-',
  'codeRow',
  'code',
  'table',
  'mermaid',
  'katex',
  'link',
  'image',
  '=',
  'prettier',
  'pageFullscreen',
  'fullscreen',
  'preview',
  'htmlPreview',
  'catalog',
]

/**
 * read-only状态下的toolbars
 */
export const readOnlyToolbars: Array<ToolbarNames> = [
  'pageFullscreen',
  'fullscreen',
  'preview',
  'htmlPreview',
  'catalog',
]

// 构造标题ID的生成方式
export function mdHeadingId(_text: string, _level: number, index: number) {
  return `heading-${index}`
}
